"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var index_1 = require("@/index");
function random(min, max) {
    return Math.floor(Math.random() * (max - min)) + min;
}
function default_1(chartTarget, dataSource, reRender, destroyMySelf) {
    if (!dataSource)
        throw new Error("component4数据源初始化失败！");
    var indicatorState = dataSource === null || dataSource === void 0 ? void 0 : dataSource.useState([]);
    var seriesStates = new Array();
    var container = document.getElementById(chartTarget === null || chartTarget === void 0 ? void 0 : chartTarget.getConfig("container"));
    var myChartTarget = window.echarts.init(container);
    var myOptions = (chartTarget === null || chartTarget === void 0 ? void 0 : chartTarget.getConfig("ChartOptions")) || {};
    myOptions.series.forEach(function (conf) {
        seriesStates.push(dataSource === null || dataSource === void 0 ? void 0 : dataSource.useState([]));
    });
    // const currentDatas = myOptions.series;
    (0, index_1.effect)(function () {
        myOptions = (chartTarget === null || chartTarget === void 0 ? void 0 : chartTarget.getConfig("ChartOptions")) || {};
        myChartTarget.setOption(myOptions);
    }, [chartTarget]);
    // effect(()=>{
    //     myChartTarget.setOption({
    //         series: newDatas
    //     });
    // },[indicatorState,...seriesStates])
    // effect(()=>{
    //     // innerSpan.innerHTML = chartTarget?.getConfig("title")||"空空如也";
    // },[chartTarget]);
    //effect(()=>{
    // let newSerise = currentDatas.map(current=>{
    //     current.data = current.data.map((data,index)=>{
    //         return {
    //             value: new Array(6).fill(random(1000,10000)),
    //             name: ['Allocated Budget','Actual Spending'][index]
    //         }
    //     });
    //     return {...current};
    // })
    //     myChartTarget.setOption({
    //         radar:{indicator:indicatorState},
    //         series: seriesStates.map((serise,index)=>{
    //             return {
    //                 value:serise.value,
    //                 name:myOptions.legend.data[index]
    //             }
    //         })
    //     });
    // },[indicatorState,...seriesStates]);
}
exports.default = default_1;
